{extend name="platform/base" /}
{block name="resources"/}
<style>
p {
    margin: 6px 0 10px;
}
.imglogo{
	min-height:80px;
}

</style>

{/block}
{block name="main"}
<section class="panel panel-default">
	<header class="panel-heading font-bold"> 版权设置 </header>
	<div class="panel-body">
		<form class="form-horizontal">
            <div class="form-group">
                  <label class="col-lg-2 control-label">版权Logo：</label>
                  <div class="col-md-4">
					<p><img id="imgLogo" src="__UPLOAD__/{$website['logo']}" class="imglogo"/></p>
                         <a href="javascript:void(0);" style="display:block;position:relative;z-index:1;">
                              <span style="width: 97px;height: 34px;position: absolute;left: 0;top: 0;z-index: 2;cursor: pointer;"> 
                              <input hidefocus="true" size="1" class="input-file" name="file_upload" id="uploadImg" nc_type="change_store_label" type="file" style="width: 97px;height: 34px;padding: 0;margin: 0;border: none 0;opacity: 0;filter: alpha(opacity = 0);cursor: pointer;" onchange="imgUpload(this);"> 
							  <input type="hidden" id="Logo" value="{$website['logo']}" />
							  </span>
						<a class="btn btn-default"><i class="fa fa-cloud-upload text"></i><span class="text">上传图片</span></a>
					    </a>
				</div>
           </div>
           <div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-2 control-label">公司名称：</label>
				<div class="col-md-4" style="width:80%;">
					<input type="text" class="form-control" id="companyname" value="{$info.copyright_companyname}" style="width:30%;">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-2 control-label">版权链接：</label>
				<div class="col-md-4" style="width:80%;">
					<input type="text" class="form-control" id="link"  value="{$info.copyright_link}" style="width:30%;">
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				 <label class="col-lg-2 control-label">网站描述</label>
                <div class="col-sm-4">
                <textarea name="store_zy" rows="2" id="third_count" class="textarea w400" style="width:350px;height:100px;">{$info.copyright_desc}</textarea>
                    <!-- <div id="desc" class="form-control" style="overflow:scroll;height:150px;max-height:150px">{$info.copyright_desc}</div> -->
                </div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<div class="col-sm-4 col-sm-offset-2">
					<a href="javascript:void(0);" onclick="setConfigAjax()" class="btn btn-primary">保存</a>
				</div>
			</div>
		</form>
	</div>
</section>
<script src="__STATIC__/js/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
<script>
//图片上传
function imgUpload(event) {
	var fileid = $(event).attr("id");
	var data = { 'file_path' : UPLOADCOMMON };
	var id = $(event).next().attr("id");
	uploadFile(fileid,data,function(res){
		if(res.code){
			$("#img"+id).attr("src",__IMG(res.data));
			$("#"+id).val(res.data);
			showTip(res.message,"success");
		}else{
			showTip(res.message,"error");
		}
	});
}
function setConfigAjax(){
	var Logo = $("#logo").val();
	var meta = $("#meta").val();
	var link = $("#link").val();
	var desc = $("#desc").val();
	var companyname = $("#companyname").val();
	$.ajax({
		type:"post",
		url : "{:__URL('PLATFORM_MAIN/config/copyrightinfo')}",
		data : {
			"copyright_logo" : Logo,
			"copyright_meta" : meta,
			'copyright_link' : link,
			"copyright_desc" : desc,
			"copyright_companyname" : companyname
		},
		success : function(data){
			
			if(data['code'] > 0){
				showMessage('success', data["message"]);
				location.href=__URL("PLATFORM_MAIN/config/copyrightinfo");
			}else{
				showMessage('error', data["message"]);
			}
		}
	})
}
</script>
{/block}